package com.longway.core.toolbox.wdp;

import java.io.Serializable;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

/**
 * 第三方平台配置
 */
public class WdpConfig implements Serializable {
	private static final long serialVersionUID = -150451050644229957L;
	private String appId = null;
    private String appSecret = null;
    private String token = null;
    private String encodingAesKey = null;
    private String componentVerifyTicket = null;
    
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppSecret() {
        return appSecret;
    }
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    public String getEncodingAesKey() {
        return encodingAesKey;
    }
    public void setEncodingAesKey(String encodingAesKey) {
        this.encodingAesKey = encodingAesKey;
    }
	public String getComponentVerifyTicket() {
		componentVerifyTicket = Db.queryStr("select ticket from auth_ticket");
		return componentVerifyTicket;
	}
	public void setComponentVerifyTicket(String componentVerifyTicket) {
		this.componentVerifyTicket = componentVerifyTicket;
		Db.tx(() -> {
			Db.delete("delete from auth_ticket");
			Db.save("auth_ticket", new Record().set("ticket", componentVerifyTicket));
			return true;
		});
	}
}
